<?php

class corpStore {
	private $dbHost = null;
	private $dbUser = null;
	private $dbPass = null;
	private $dbName = null;
	
	
	public function setCredentials($dbHost, $dbUser, $dbPass, $dbName){
		$this->dbHost = $dbHost;
		$this->dbUser = $dbUser;
		$this->dbPass = $dbPass;
		$this->dbName = $dbName;
	} //end setCredentials
	
	
	//build list of items in inventory table
	public function getItems() {
		$dbh = mysql_connect ( $this->dbHost, $this->dbUser, $this->dbPass ) or die ( mysql_error () );
		mysql_select_db ( $this->dbName );
		$sql = "select t.typeName, i.qty_onhand, i.price from invTypes t, cs_Inventory i where t.typeID = i.item_id";
		$result = mysql_query ( $sql, $dbh ) or die ( mysql_error () );
		$recCount = mysql_num_rows ( $result );
		$itemArray = array ();
		if ($recCount > 0) {
			while ( $newArray = mysql_fetch_array ( $result ) ) {
				$itemArray [] = $newArray;
			} //end of while loop
		} else {
		
		}
		return $itemArray;
	}
} //end class


?>